<script setup>
	import { http } from '@/utils/http.js'
	import { useCounterStore } from '@/stores/counter.js'
	import { textCounterStore } from '@/stores/test.js'
	function onButtonClick() {
		// 1. 普通用法
		http.request({
			url: '/echo',
			method: 'GET',
			// header: {
			// 	customHeader: '22222222',
			// },
		})
		uni.utils.toast('数据加载成功')
	}

	const counterStore = useCounterStore()
	const textcountStore = textCounterStore()
	const addBtn = () => {
		counterStore.increment()
	}
</script>

<template>
	<button @click="addBtn">+</button>
	<view> {{ counterStore.count }} </view>
	<view>2:{{ textcountStore.textcount }}</view>
	<hr />
	<view>
		<button @click="onButtonClick">调用接口</button>
	</view>
</template>

<style lang="scss">
	.text {
		width: 375rpx;
		@include text-overflow(3);
	}
</style>